package cn.njxzc.examples;

import java.io.*;

public class Exam9_13 {
	public static void main(String[] args) {
		try {

			FileInputStream file = new FileInputStream(args[0]);
			InputStreamReader isr = new InputStreamReader(file);
			BufferedReader buf = new BufferedReader(isr);
			LineNumberReader line = new LineNumberReader(buf);
			String tmp;
			String key = args[1];
			while ((tmp = line.readLine()) != null) {
				if (tmp.indexOf(key) >= 0)
					System.out.println((line.getLineNumber()) + ": " + tmp);
			}
			line.close();
		} catch (FileNotFoundException e) {
			System.out.println(e);
		} catch (IOException e) {
			System.out.println(e);
		}
	}
}
